package com.itheima.health.controller.user;

import com.itheima.health.common.MessageConst;
import com.itheima.health.dto.MemberPlssParm;
import com.itheima.health.result.BusinessRequest;
import com.itheima.health.result.Result;
import com.itheima.health.service.MemberService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;


@RestController
@RequestMapping("report")
@Slf4j
public class MemberContrller {
    @Autowired
    private MemberService memberService;
    @GetMapping("/getMemberReport")
    public Result getMemberReport( ){
        log.info("[统计分析-会员数量图表显示]");
        MemberPlssParm members = memberService.getMemberReport();
        return new Result(true, MessageConst.GET_MEMBER_NUMBER_REPORT_SUCCESS, members);
    }
    @GetMapping("/getSetmealReport")
    public Result getSetmealReport() {
        log.info("[统计分析-套餐预约占比饼形图]");
        Map<String, Object> data = memberService.getSetmealReport();
        return new Result(true, MessageConst.GET_SETMEAL_COUNT_REPORT_SUCCESS, data);
    }

    @GetMapping("/getBusinessReportData")
    public Result getBusinessReportData(){
        log.info("[统计分析-营数据统计]");
        BusinessRequest request = memberService.getBusinessReportData();
        return new Result(true , MessageConst.GET_BUSINESS_REPORT_SUCCESS,request);
    }
}
